package com.huawei.appmarket.service.store.awk.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import com.huawei.appgallery.horizontalcard.api.card.BaseHorizontalItemCard;
import com.huawei.appmarket.service.store.awk.card.HorizontalBigImgItemCard;
import o.cdr;
import o.cgz;
import o.chy;
import o.eib;
import o.ewm.d;
import o.ewm.h;

public class LargeImgListNode extends cdr {
    private BaseHorizontalItemCard ˊ;

    public LargeImgListNode(Context context) {
        super(context, 0);
    }

    public int ˏ() {
        return HorizontalBigImgItemCard.ॱˊ();
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        if (viewGroup == null) {
            return false;
        }
        LinearLayout ˏ = ˏ(viewGroup);
        LayoutInflater from = LayoutInflater.from(this.ॱ);
        LayoutParams layoutParams = new LinearLayout.LayoutParams(viewGroup.getContext().getResources().getDimensionPixelSize(d.ᐨ), -1);
        for (int i = 0; i < ˏ(); i++) {
            this.ˊ = new HorizontalBigImgItemCard(this.ॱ);
            View view = (LinearLayout) from.inflate(h.ʼˊ, null);
            this.ˊ.ˏ(view);
            if (i != 0) {
                viewGroup.addView(new Space(this.ॱ), layoutParams);
            }
            ˊ(this.ˊ);
            ˏ.addView(view, new LinearLayout.LayoutParams(0, -1, 1.0f));
        }
        return true;
    }

    public boolean ॱ() {
        return false;
    }

    @NonNull
    private LinearLayout ˏ(ViewGroup viewGroup) {
        int ॱॱ = eib.ॱॱ();
        int ʽ = eib.ʽ();
        int ˊ = eib.ˊ();
        int ᐝ = eib.ᐝ();
        int ˏ = eib.ˏ();
        if (ˏ((View) viewGroup)) {
            LinearLayout linearLayout = (LinearLayout) viewGroup;
        } else {
            View linearLayout2 = new LinearLayout(this.ॱ);
            linearLayout2.setOrientation(0);
            viewGroup.addView(linearLayout2, new LinearLayout.LayoutParams(-1, -1));
            viewGroup = linearLayout2;
        }
        viewGroup.setPadding(ॱॱ, ˊ, ʽ, ᐝ);
        viewGroup.setDividerPadding(ˏ);
        return viewGroup;
    }

    public void ˋ(chy o_chy) {
        int i = 0;
        while (i < ˊॱ()) {
            cgz ˊ = ˊ(i);
            if (ˊ instanceof HorizontalBigImgItemCard) {
                ((HorizontalBigImgItemCard) ˊ).ॱ(o_chy);
                i++;
            } else {
                return;
            }
        }
    }

    private boolean ˏ(View view) {
        return view != null && (view instanceof LinearLayout) && ((LinearLayout) view).getOrientation() == 0;
    }
}
